package com.fansl.allround.daemon.quartz.task;

import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSONObject;
import com.fansl.allround.daemon.quartz.entity.ScheduleJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author fansl
 * @Description: TODO
 * @date 2020/1/11 15:49
 */
@Slf4j
@Component
public class DemoTask {
    public void sayHello(){
        log.info("hello world!");
    }

    public void saySomething(String something){
        log.info("say something :{}",something);
    }

    public void sayHelloToPerson(String something,String person){
        log.info("say something :{},person:{}",something,person);
    }

    public void saySomethingObj(String something, ScheduleJob scheduleJob){
        log.info("say something :{},scheduleJob:{}",something,JSONObject.toJSONString(scheduleJob));
        if (RandomUtil.randomInt(0,100)>80){
            throw new RuntimeException("自定义异常");
        }
    }
}
